package com.rlg.dao.Impl;

import com.rlg.dao.EbookDao;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

import static org.junit.Assert.*;

public class EbookDaoImplTest {

    @Test
    public void findEbook() {
        ApplicationContext context=new ClassPathXmlApplicationContext("applicationContext.xml");
        SessionFactory factory=(SessionFactory) context.getBean("sessionFactory");
        Query query=factory.openSession().createQuery("from EbookEntry");
        List<EbookDao> list=query.list();
        System.out.println(list.size());
    }
}